//饼图
function delStatusShow(data){
	var dom = document.getElementById("delStatus");
	var myChart = echarts.init(dom);
	option = null;
	option = {
		color:data.color,
		title : {
			text: data.title,
			//subtext: 'null',
			x:'center'
		},
		tooltip : {
			trigger: 'item',
			formatter: "{a} <br/>{b} : {c} ({d}%)"
		},
		legend: {
			orient: 'vertical',
			left: '18',
			bottom:'5',
			data: data.txt
		},
		series : [
			{
				name: ' ',
				type: 'pie',
				radius : '55%',
				center: ['50%', '60%'],
				data:data.args,
				itemStyle: {
					emphasis: {
						shadowBlur: 10,
						shadowOffsetX: 0,
						shadowColor: 'rgba(0, 0, 0, 0.5)'
					}
				}
			}
		]
	};
	if (option && typeof option === "object") {
		myChart.setOption(option, true);
	}
}

//柱形图
function currentStatusShow(data){
	var dom = document.getElementById("currentStatus");
	var myChart = echarts.init(dom);
	option = null;

	option = {
		title:{
			text: data.title,
			//subtext: 'null',
			x:'center'
		},
		color: ['#3398DB'],
		tooltip : {
			trigger: 'axis',
			axisPointer : {            // 坐标轴指示器，坐标轴触发有效
				type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
			}
		},
		grid: {
			left: '3%',
			right: '4%',
			bottom: '3%',
			containLabel: true
		},
		xAxis : [
			{
				type : 'category',
				data : data.txt,
				axisTick: {
					alignWithLabel: true
				}
			}
		],
		yAxis : [
			{
				type : 'value'
			}
		],
		series : [
			{
				name:'',
				type:'bar',
				barWidth: '40%',
				data:data.args
			}
		]
	};
	;
	if (option && typeof option === "object") {
		myChart.setOption(option, true);
	}
}

window.onload=function(){
	var W = document.documentElement.clientWidth;
	sizeFun(W);
};

function sizeFun(e){
	if(e<1281){
		sizeFun_inside("true",750,15,350,180,400,180);
	}else if(e<1361){
		sizeFun_inside("true",850,20,350,200,500,200);
	}else if(e<1441){
		sizeFun_inside("true",930,30,430,240,500,240);
	}else if(e<1601){
		sizeFun_inside("true",930,160,430,240,500,240);
	}else if(e<1920){
		sizeFun_inside("true",930,200,430,240,500,240);
	}else{
		sizeFun_inside("false");
	}
}

function sizeFun_inside(judge,q,w,e,r,t,y){
	if(judge=="true"){
		$('#echartsShow').css({"width":q+"px","left":w+"px"});
		$('#echartsShow .delStatus').css({"width":e+"px","height":r+"px"});
		$('#echartsShow .currentStatus').css({"width":t+"px","height":y+"px"});		
	}else{
		$('#echartsShow').css({"left":($(window).width()-$("#echartsShow").width())/2+'px'});		
	}
}